package org.project.s.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.project.pojo.SysUser;
import org.project.service.user.SysUserService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
@Controller
@RequestMapping("/systemuser")
public class Sysusercontroller {

	@Resource
	private SysUserService sysUserService;
	
	@RequestMapping("/xiugaimima")
	public String xiugaimima(){
		HttpServletRequest req = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
		 String password= req.getParameter("password2");
		
		HttpSession  session=req.getSession();
		SysUser  user=new SysUser();
		 int id= (Integer) session.getAttribute("userid");
		
		 user.setPassWord(password);
		 user.setId(id);
		int i=	sysUserService.xiugaimima(user);
		if(i>0){
		return "mainfra";
	}else{
		return "";
		
	}
	}
	
	@RequestMapping("/adduser")
	public String adduser(SysUser  user){
	  int i=sysUserService.tianjiauser(user);
	  
	  if(i>0){
		  return "mainfra";
	  }else{
		  return "";
	  }
	}
}
